<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAdsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('ads', function (Blueprint $table) {
            $table->increments('id');
            $table->string('ads_img', 150)->default('')->comment('广告图片');
            $table->string('ads_title', 100)->default('')->comment('广告标题');
            $table->string('ads_url', 100)->default('')->comment('广告链接');
            $table->dateTime('ads_starttime')->comment('开始时间');
            $table->dateTime('ads_endtime')->comment('结束时间');
            $table->tinyInteger('ads_position')->default(1)->comment('广告位置');
            $table->tinyInteger('ads_status')->default(1)->comment('广告开关，1开启0关闭-1删除');
            $table->index('ads_position');
            $table->index(['ads_starttime', 'ads_endtime']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('ads');
    }
}
